package com.wjk.kylin.mall.common.core.enums;

import com.wjk.kylin.mall.common.core.util.StringUtils;
import lombok.Data;
import lombok.Getter;

/**
 * 认证方式枚举
 *
 * @date 2021/10/4
 */
public enum AuthenticationMethodEnum {

    USERNAME("username", "用户名"),
    MOBILE("mobile", "手机号"),
    OPENID("openId", "开放式认证系统唯一身份标识");

    private String value;
    private String label;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    AuthenticationMethodEnum(String value, String label) {
        this.value = value;
        this.label = label;
    }

    public static AuthenticationMethodEnum getByValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (AuthenticationMethodEnum item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

}
